package com.ychong.ychongwidget

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.recyclerview.widget.LinearLayoutManager
import com.ychong.ychongwidget.databinding.ActivityMainBinding
import com.ychong.ychongwidget.ui.*
import com.ychong.ychongwidget.ui.YCHZoomImageViewActivity

class MainActivity : AppCompatActivity() {
    private var binding: ActivityMainBinding? = null
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = ActivityMainBinding.inflate(layoutInflater)
        setContentView(binding!!.root)
        val adapter = TextRecyclerAdapter(this, ListUtils.getList())
        binding!!.recycler.layoutManager = LinearLayoutManager(this)
        binding!!.recycler.adapter = adapter

        adapter.setItemClickListener(object : TextRecyclerAdapter.ItemClickListener {
            override fun click(item: String) {
                when (item) {
                    "LoadingDialog" -> {
                        startActivity(
                            Intent(
                                this@MainActivity,
                                LoadingDialogActivity::class.java
                            )
                        )
                    }
                    "TipsDialog" -> {
                        startActivity(Intent(this@MainActivity, TipsDialogActivity::class.java))
                    }
                    "InputDialog" -> {
                        startActivity(
                            Intent(
                                this@MainActivity,
                                InputDialogActivity::class.java
                            )
                        )

                    }
                    "MessageDialog" -> {
                        startActivity(
                            Intent(
                                this@MainActivity,
                                MessageDialogActivity::class.java
                            )
                        )
                    }
                    "ResultDialog" -> {
                        startActivity(
                            Intent(
                                this@MainActivity,
                                ResultDialogActivity::class.java
                            )
                        )
                    }
                    "ToastDialog" -> {
                        startActivity(
                            Intent(
                                this@MainActivity,
                                ToastDialogActivity::class.java
                            )
                        )
                    }
                    "BottomListDialog" -> {
                        startActivity(
                            Intent(
                                this@MainActivity,
                                BottomListDialogActivity::class.java
                            )
                        )
                    }
                    "YCHZoomImageView" -> {
                        startActivity(
                            Intent(
                                this@MainActivity,
                                YCHZoomImageViewActivity::class.java
                            )
                        )
                    }
                    "YCHWheelPickerView" -> {
                        startActivity(Intent(this@MainActivity, YCHWheelPickerActivity::class.java))
                    }
                    "YCHEditText" -> {
                        startActivity(Intent(this@MainActivity, YCHEditTextActivity::class.java))
                    }
                    "YCHButton" -> {
                        startActivity(Intent(this@MainActivity, YCHButtonActivity::class.java))
                    }
                    "YCHPlateInputView" ->{
                        startActivity(Intent(this@MainActivity, YCHPlateInputViewActivity::class.java))
                    }
                    "TianZiGeView" ->{
                        startActivity(Intent(this@MainActivity, TianZiGeViewActivity::class.java))
                    }
                    "ImageBannerView"  ->{
                        startActivity(Intent(this@MainActivity,ImageBannerViewActivity::class.java))
                    }
                    "MorePhotoView" ->{
                        startActivity(Intent(this@MainActivity,MorePhotoViewActivity::class.java))
                    }
                    "YCHPlateKeyBoardView" ->{
                        startActivity(Intent(this@MainActivity,YCHPlateKeyBoardViewActivity::class.java))
                    }
                    "LargeImageView" ->{
                        startActivity(Intent(this@MainActivity,LargeImageViewActivity::class.java))
                    }
                    "SpreadView" ->{
                        startActivity(Intent(this@MainActivity,SpreadViewActivity::class.java))
                    }

                }
            }

        })

    }
}